<%@ include file="/platform/common/header.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script language="JavaScript" type="text/javascript" src="<common:webRoot />/resources/component/angular/ng-infinite-scroll.js?v=${sysversion}"></script>
<style>
    .list-group-item{
        font-size: 0.86rem;
        padding-top: 5px;
        padding-bottom: 5px;
        border-radius: 0 !important;
        border: 1px solid #e8e8e8 !important;
    }
    .list-group .searchDetail-no-data{
        padding: 30px 0;
        text-align: center;
        color: #ed3f14;
        font-size: 16px;
    }
</style>
<body ng-init="pageTitle='人员选择树'; isMulti = '${isMulti}'; flowType = '${flowInfo}'; roles = '${roles}'; rootXH = '${root}'; yhzws = '${yhzws}';">
<div class="container-fluid" ng-controller="UserController" ng-cloak  style="height: 100%">
    <div class="row" style="height: 100%">
        <div class="col-xs-10" style="border-right: 1px solid #e8e8e8;height: 100%;overflow: auto;padding: 0;position: relative;">
            <div style="position: absolute;right: 5px;top: 5px;">
                <input type="text" class="searchFilter" ng-model="searchFilter" placeholder="输入姓名查询" ng-keyup="myKeyup($event)">
            </div>
            <uib-tabset active="active">
                <uib-tab index="0" heading="部门"  select="setTab('tab0')">
                    <div ng-controller="deptUserController">
                        <div class="col-xs-5" style="padding: 0;border-right: 1px solid #e8e8e8">
                            <div id="dept-list" style="height: 450px;overflow: auto;">
                                <ul id="leftTree" class="ztree" ng-show="deptId === 'ROOT'"></ul>
                                <div ng-if = "deptId !== 'ROOT'"  class="list-group">
                                    <div ng-click="showSelectedDept(group)" ng-repeat="group in allDept" class="list-group-item hiddenOverflow" ng-class="{true: 'active', false: 'inactive'}[group.check]"  data-id="{{group.id}}">
                                        {{group.zzqc}}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-7" style="padding: 0">
                            <div id="user-list" style="height: 450px;overflow: auto;" ng-if="!showSearchList && isMulti == 1"
                                 infinite-scroll='loadMore()' infinite-scroll-distance='30'>
                                <div class="bm-content" on-finish-render-filters ng-repeat ="group in allDept | limitTo : showDeptNum"
                                     name="{{group.id}}_li_content" id="{{group.id}}_li_content" ng-if="!group.HideDept">
                                    <p class="zzqc">
                                        <input class="magic-checkbox" type="checkbox" name="item" id="{{group.id}}"
                                               ng-model="group.check" ng-value="group.id"  ng-change="checkGroupUser(group)">
                                        <label  title="{{group.zzqc}}" for="{{group.id}}">{{group.zzqc}}</label>
                                    </p>
                                    <p class="no-bmry-tips" ng-if="!group.rylb.length">此部门下暂无数据</p>
                                    <ul class="bmry-content" ng-if="group.rylb.length">
                                        <li ng-repeat="item in group.rylb">
                                            <input class="magic-checkbox" type="checkbox" name="item" id="{{item.id}}" title="{{item.name}}"
                                                   ng-model="item.check" ng-value="item.id"  ng-change="checkItemUser(item)">
                                            <label title="{{item.name}}" for="{{item.id}}">{{item.minname}}</label>
                                        </li>
                                    </ul>
                                </div>
                            </div>

                            <div id="user-list" style="height: 450px;overflow: auto;" ng-if="!showSearchList && isMulti == 0"
                                 infinite-scroll='loadMore()' infinite-scroll-distance='30'>
                                <div class="bm-content" on-finish-render-filters ng-repeat="group in allDept | limitTo : showDeptNum"
                                     name="{{group.id}}_li_content" id="{{group.id}}_li_content"  ng-if="!group.HideDept">
                                    <p class="zzqc">
                                        <label for="{{group.id}}">{{group.zzqc}}</label>
                                    </p>
                                    <p class="no-bmry-tips" ng-if="!group.rylb.length">此部门下暂无数据</p>
                                    <ul class="bmry-content" ng-if="group.rylb.length">
                                        <li ng-repeat="item in group.rylb">
                                            <input class="magic-radio" type="checkbox" name="user" id="{{item.id}}"  title="{{item.name}}"
                                                   ng-model="item.check" ng-value="item.id" ng-change="checkItemUser4Single(item)">
                                            <label title="{{item.name}}" for="{{item.id}}">{{item.minname}}</label>
                                        </li>
                                    </ul>
                                </div>
                            </div>

                            <div class="list-group" ng-if="showSearchList && isMulti == 1" style="height: 445px;overflow: auto"
                                 infinite-scroll='loadMore()' infinite-scroll-distance='30'>
                                <p ng-show="searchUser.length < 1" class="searchDetail-no-data">找不到数据，请重试</p>
                                <div ng-repeat="group in allDept" ng-if="group.searchShow">
                                    <a ng-class="{true: 'active', false: 'inactive'}[item.check]" data-id="{{item.id}}"
                                       ng-click="selectItems(item,$event)" class="list-group-item hiddenOverflow"
                                       ng-repeat="item in group.rylb"  ng-if="!item.HideUserSearch">{{item.name}}/{{group.zzqc}}</a>
                                </div>
                            </div>

                            <div class="list-group" ng-if="showSearchList && isMulti == 0" style="height: 445px;overflow: auto"
                                 infinite-scroll='loadMore()' infinite-scroll-distance='30'>
                                <p ng-show="searchUser.length < 1" class="searchDetail-no-data">找不到数据，请重试</p>
                                <div ng-repeat="group in allDept" ng-if="group.searchShow">
                                    <a ng-class="{true: 'active', false: 'inactive'}[item.check]" data-id="{{item.id}}"
                                       ng-click="checkItemUser4Single(item)" class="list-group-item hiddenOverflow" title="{{item.name}}/{{group.zzqc}}"
                                       ng-repeat="item in group.rylb"  ng-if="!item.HideUserSearch">{{item.name}}/{{group.zzqc}}</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </uib-tab>

                <uib-tab index="1" heading="角色" ng-show="showFlag4Role" select="setTab('tab1')" >
                    <div ng-controller="roleUserController">
                        <div class="col-xs-5" style="padding: 0;border-right: 1px solid #e8e8e8">
                            <div id="dept-list" style="height: 450px;overflow: auto;">
                                <ul id="roleTree" class="ztree"></ul>
                            </div>
                        </div>
                        <div class="col-xs-7" style="padding: 0">
                            <div id="user-list" style="height: 450px;overflow: auto;" ng-if="!showSearchList && isMulti == 1"
                                 infinite-scroll='loadMoreRole()' infinite-scroll-distance='30'>
                                <div class="bm-content" on-finish-render-filters ng-repeat ="group in allRole | limitTo : showRoleNum"
                                     name="{{group.id}}_li_content" id="{{group.id}}_li_content" ng-if="!group.HideRole">
                                    <p class="zzqc">
                                        <input class="magic-checkbox" type="checkbox" name="item" id="{{group.id}}"
                                               ng-model="group.check" ng-value="group.id"  ng-change="checkGroupUser4Role(group)">
                                        <label for="{{group.id}}">{{group.name}}</label>
                                    </p>
                                    <p class="no-bmry-tips" ng-if="!group.rylb.length">此角色下暂无数据</p>
                                    <ul class="bmry-content" ng-if="group.rylb.length">
                                        <li ng-repeat="item in group.rylb">
                                            <input class="magic-checkbox" title="{{item.name}}" type="checkbox" name="item_role" id="{{item.id}}_user_role"
                                                   ng-model="item.check" ng-value="item.id"  ng-change="checkItemUser4Role(item)">
                                            <label title="{{item.name}}" for="{{item.id}}_user_role">{{item.name}}</label>
                                        </li>
                                    </ul>
                                </div>
                            </div>

                            <div id="user-list" style="height: 450px;overflow: auto;" ng-if="!showSearchList && isMulti == 0"
                                 infinite-scroll='loadMore()' infinite-scroll-distance='30'>
                                <div class="bm-content" on-finish-render-filters ng-repeat="group in allRole | limitTo : showRoleNum"
                                     name="{{group.id}}_li_content" id="{{group.id}}_li_content"  ng-if="!group.HideRole">
                                    <p class="zzqc">
                                        <label for="{{group.id}}">{{group.name}}</label>
                                    </p>
                                    <p class="no-bmry-tips" ng-if="!group.rylb.length">此角色下暂无数据</p>
                                    <ul class="bmry-content" ng-if="group.rylb.length">
                                        <li ng-repeat="item in group.rylb">
                                            <input class="magic-radio" type="checkbox" name="user_role" id="{{item.id}}_{{item.JSBH}}_user_role"  ng-model="item.check" ng-value="item.id" ng-change="checkItemUser4Single(item)">
                                            <label  title="{{item.name}}" for="{{item.id}}_{{item.JSBH}}_user_role">{{item.name}}</label>
                                        </li>
                                    </ul>
                                </div>
                            </div>

                            <div class="list-group" ng-if="showSearchList && isMulti == 1" style="height: 445px;overflow: auto"
                                 infinite-scroll='loadMore()' infinite-scroll-distance='30'>
                                <div ng-repeat="group in allRole" ng-if="group.searchShow">
                                    <a ng-class="{true: 'active', false: 'inactive'}[item.check]" data-id="{{item.id}}"
                                       ng-click="selectItems(item,$event)" class="list-group-item hiddenOverflow"
                                       ng-repeat="item in group.rylb"  ng-if="!item.HideUserSearch">{{item.name}}/{{group.name}}</a>
                                </div>
                            </div>

                            <div class="list-group" ng-if="showSearchList && isMulti == 0" style="height: 445px;overflow: auto"
                                 infinite-scroll='loadMore()' infinite-scroll-distance='30'>
                                <div ng-repeat="group in allRole" ng-if="group.searchShow">
                                    <a ng-class="{true: 'active', false: 'inactive'}[item.check]" data-id="{{item.id}}"
                                       ng-click="checkItemUser4Single(item)" class="list-group-item hiddenOverflow"
                                       ng-repeat="item in group.rylb"  ng-if="!item.HideUserSearch">{{item.name}}/{{group.name}}</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </uib-tab>
            </uib-tabset>
        </div>
        <div class="col-xs-2" style="height: 100%;overflow: auto;padding: 0">
            <div class="clear-title" ng-click="cancelAll()">
                <span style="font-size: 1rem;">取消选择</span>
                <i class="clear-img-all"></i>
            </div>
            <div class="all-select-content">
                <ul>
                    <li ng-repeat="item in hasCheckModelObj track by item.id" ng-mouseover="showDel = true" ng-mouseleave="showDel = false" ng-init="showDel = false">
                        <span>{{item.name}}</span>
                        <i ng-show="showDel" class="clear-img" ng-click="deleteSelect(item)" style="cursor: pointer"></i>
                    </li>
                </ul>
            </div>
            <div class="confirm-select" ng-click="confirm()">
                <span style="font-size: 1rem;">确定</span>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="<common:webRoot/>/resources/platform/common/component/usertree/usertreev4.js?v=${sysversion}"></script>
</body>
<%@ include file="/platform/common/footer.jsp" %>